﻿@model AlbumVideo[]

@{
    var albums = Model
                    .Select(a => a.VideoAlbum)
                    .Distinct()
                    .ToArray();
}

<div>
@for (int albumIdx = 0; albumIdx < albums.Length; albumIdx++)
{
    <!-- album wrapper-->
    <div style="clear:both;">
    <!-- holder for an album -->
    <div class="album-wrapper">
        <img src="@albums[albumIdx].IconUrl" alt="@albums[albumIdx].AlbumName" />
        <div class="album">
            @albums[albumIdx].AlbumName
        </div>
    </div>
    
    <p>

    @{
    var videos = Model
                .Where(a => a.VideoAlbumID == albums[albumIdx].VideoAlbumID)
                .ToArray();
    }

    @foreach (var video in videos)
    {
        <!-- holder for individual videos -->
        <div class="video-wrapper">
            <img src="@video.YoutubeVideo.IconUrl" alt="@video.YoutubeVideo.VideoTitle" />
           
            <div class="you-video">
                 @video.YoutubeVideo.VideoTitle
            </div>
        </div>
    }
    </p>
    </div>
}
</div>